(function () {
  // 步骤3：创建echarts实例
  let myChart = echarts.init(document.querySelector(".box-r2"));

  // 步骤4：定义配置（指定图表的配置项和数据）
  let option = {
    tooltip: {
      trigger: "item",
    },
    legend: {
      top: "5%",
      left: "center",
    },
    series: [
      {
        name: "",
        type: "pie",
        radius: ["40%", "70%"],
        center: ["50%", "60%"],
        avoidLabelOverlap: false,
        itemStyle: {
          borderRadius: 10,
          borderColor: "#fff",
          borderWidth: 1,
        },
        label: {
          show: false,
          position: "center",
        },
        labelLine: {
          show: false,
        },
        data: [
          { value: 648, name: "图例1" },
          { value: 735, name: "图例2" },
          { value: 580, name: "图例3" },
          { value: 484, name: "图例4" },
          { value: 300, name: "图例5" },
        ],
      },
    ],
  };
  // 步骤5：使用刚指定的配置项和数据显示图表
  myChart.setOption(option);

  window.onresize = function () {
    myChart.resize();
  };
})();
